﻿<UserControl x:Class="StockAnalyst2.Chart.ChartViewer"
			 x:ClassModifier="internal"
			 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             
             xmlns:Wpf="clr-namespace:Utils.Wpf;assembly=Utils" 
			 xmlns:Converter="clr-namespace:Utils.Wpf.Converters;assembly=Utils" 
			 xmlns:SA2Chart="clr-namespace:StockAnalyst2.Chart"
             xmlns:Charts="clr-namespace:Visiblox.Charts;assembly=Visiblox.Charts"
             xmlns:local="clr-namespace:StockAnalyst2.Converters"

             mc:Ignorable="d" 
			 
			 Wpf:AnimatorOnVisibilityChange.AnimationType="Fade"
			 Wpf:AnimatorOnVisibilityChange.Duration="750"
			 
             d:DesignHeight="600" 
			 d:DesignWidth="1400"
			 d:DataContext="{d:DesignInstance SA2Chart:ChartViewerVM}" >
	
	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="..\StockAnalystTheme.xaml" />
			</ResourceDictionary.MergedDictionaries>

			<Style TargetType="Line" x:Key="MajorTickStyle" >
				<Setter Property="Stroke" Value="#CCCCCC" />
			</Style>

			<Style TargetType="Path" x:Key="GridStripeStyle" >
				<Setter Property="Fill" Value="#802F2F2F" />
			</Style>

			<Style TargetType="Line" x:Key="MajorGridlineStyle" >
				<Setter Property="Stroke" Value="#2F2F2F" />
			</Style>

			<Style TargetType="Border" x:Key="PlotAreaBorderStyle" >
				<Setter Property="BorderThickness" Value="0" />
			</Style>

			<Style TargetType="Charts:Legend" x:Key="LegendStyle" >
				<Setter Property="BorderBrush" Value="#1F1F1F" />
				<Setter Property="Background" Value="#70777777" />
			</Style>

			<!-- Crosshair -->
			<Style TargetType="Charts:Crosshair" x:Key="CrosshairStyle" >
				<Setter Property="Foreground" Value="#111111" />
				<Setter Property="Background" Value="#AAAAAA" />
			</Style>

			<ControlTemplate TargetType="Charts:Crosshair" x:Key="CrosshairTemplate">
				<Canvas>
					<Line Stroke="#D7D7D7" StrokeThickness="1" X1="{TemplateBinding X}" X2="{TemplateBinding X}" Y1="0" Y2="5000" />
					<Line Stroke="#D7D7D7" StrokeThickness="1" Y1="{TemplateBinding Y}" Y2="{TemplateBinding Y}" X1="0" X2="5000" />
					<Border CornerRadius="5" Background="#D7D7D7" Canvas.Top="{TemplateBinding Y}" Canvas.Left="{TemplateBinding X}" BorderBrush="{TemplateBinding Foreground}" BorderThickness="2" Margin="5" >
						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition />
								<ColumnDefinition />
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition />
								<RowDefinition />
							</Grid.RowDefinitions>
							<TextBlock Grid.Row="0" Grid.Column="0" Margin="3,1,1,1" Text="Y: " Foreground="Black" FontWeight="Bold" />
							<TextBlock Grid.Row="0" Grid.Column="1" Margin="1,1,3,1" Text="{TemplateBinding FormattedYValue}" />
							<TextBlock Grid.Row="1" Grid.Column="0" Margin="3,1,1,2" Text="X: " Foreground="Black" FontWeight="Bold" />
							<TextBlock Grid.Row="1" Grid.Column="1" Margin="1,1,3,2" Text="{TemplateBinding FormattedXValue}"  />
						</Grid>
					</Border>
				</Canvas>
			</ControlTemplate>

			<local:BarValueConverter x:Key="BarValueConverter" />

			<!-- define Tooltip template to use on bars -->
			<ControlTemplate x:Key="CustomTooltipTemplate">
				<Border CornerRadius="5" BorderBrush="Black" BorderThickness="2" Margin="5" Background="#D7D7D7" >
					<Grid>
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
							<ColumnDefinition />
						</Grid.ColumnDefinitions>
						<TextBlock Grid.Row="0" Text="Date: " Foreground="Black" FontWeight="Bold" />
						<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding X}" Foreground="Black" />
						<TextBlock Grid.Row="1" Text="High: " Foreground="Black" FontWeight="Bold" />
						<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Converter={StaticResource BarValueConverter}, ConverterParameter=High}" Foreground="Black" />
						<TextBlock Grid.Row="2" Text="Low: " Foreground="Black" FontWeight="Bold" />
						<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Converter={StaticResource BarValueConverter}, ConverterParameter=Low}" Foreground="Black" />
						<TextBlock Grid.Row="3" Text="Open: " Foreground="Black" FontWeight="Bold" />
						<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Converter={StaticResource BarValueConverter}, ConverterParameter=Open}" Foreground="Black" />
						<TextBlock Grid.Row="4" Text="Close: " Foreground="Black" FontWeight="Bold" />
						<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Converter={StaticResource BarValueConverter}, ConverterParameter=Close}" Foreground="Black" />
					</Grid>
				</Border>
			</ControlTemplate>
			
			<Converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
			<Converter:MultiplierConverter x:Key="MultiplierConverter" />
		</ResourceDictionary>
	</UserControl.Resources>

	<UserControl.Background>
		<StaticResource ResourceKey="ChartBackground" />
	</UserControl.Background>

	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<!-- Main Chart -->
		<!-- The collapsed / hidden trick is done this way to avoid a crash at Visiblox component -->
		<Charts:Chart Grid.Row="0" LegendTitle="{Binding Path=Series[0].DataSeries.Count, RelativeSource={RelativeSource Self}}"  LegendPosition="InsideTopRight" PlotAreaBorderStyle="{StaticResource PlotAreaBorderStyle}" LegendStyle="{StaticResource LegendStyle}" x:Name="MainChart" Margin="0,10,0,10" Visibility="{Binding IsMainDataLoaded, Converter={StaticResource BooleanToVisibilityConverter}}" ValidationKey="fjiGWGIJwgvrwpigjwgvWRPIJVBwvWJVWGRI==FWOEgiid/FEQgjiewgmñagdskgORGJID+qPny4sfiej39ri+B+RimHg38HpnYuncqfh3JwxT4mdu1mJFgHWHhTpJGLI1+kXI21mhrywMI5bAD7f64kQFRGIrim6ydMz3aPm+eDO2Cd6RbMd0e8s=BQxSUisl3BaWf/7myRmmlIjRnMU2cA7q+/03ZX9wdj30RzapYANf51ee3Pi8m2rVW6aD7t6Hi4Qy5vv9xpaQYXF5T7XzsafhzS3hbBokp36BoJZg8IrceBj742nQajYyV7trx5GIw9jy/V6r0bvctKYwTim7Kzq+YPWGMtqtQoU=PFJTQUtleVZhbHVlPjxNb2R1bHVzPnh6YlRrc2dYWWJvQUh5VGR6dkNzQXUrUVAxQnM5b2VrZUxxZVdacnRFbUx3OHZlWStBK3pteXg4NGpJbFkzT2hGdlNYbHZDSjlKVGZQTTF4S2ZweWZBVXBGeXgxRnVBMThOcDNETUxXR1JJbTJ6WXA3a1YyMEdYZGU3RnJyTHZjdGhIbW1BZ21PTTdwMFBsNWlSKzNVMDg5M1N4b2hCZlJ5RHdEeE9vdDNlMD08L01vZHVsdXM+PEV4cG9uZW50PkFRQUI8L0V4cG9uZW50PjwvUlNBS2V5VmFsdWU+" >

			<Charts:Chart.YAxis>
				<Charts:LinearAxis Foreground="#CCCCCC" ShowMinorTicks="False" MajorTickStyle="{StaticResource MajorTickStyle}" Width="{Binding ActualWidth, ElementName=SecondaryAxis}" IsAutoMarginEnabled="False" ShowMajorGridlines="False" ShowMinorGridlines="False" />
			</Charts:Chart.YAxis>

			<!-- It is not used, it's here just to maintaing the same margin as the other charts -->
			<Charts:Chart.SecondaryYAxis>
				<Charts:LinearAxis Foreground="#CCCCCC" ShowMinorTicks="False" MajorTickStyle="{StaticResource MajorTickStyle}" Width="{Binding ActualWidth, ElementName=SecondaryAxis}" IsAutoMarginEnabled="False" ShowMajorGridlines="False" ShowMinorGridlines="False" />
			</Charts:Chart.SecondaryYAxis>
			
			<Charts:Chart.XAxis>
				<Charts:DateTimeAxis Range="{Binding XRange, Mode=TwoWay}" Zoom="{Binding Zoom, Mode=TwoWay}" AutoScaleToVisibleData="False" ShowGridStripes="True" GridStripeStyle="{StaticResource GridStripeStyle}" MajorGridlineStyle="{StaticResource MajorGridlineStyle}" ShowAxis="False" LabelFormatString="HH\\:mm\\:ss" Wpf:SizeObserver.Observe="True" Wpf:SizeObserver.ObservedWidth="{Binding ChartAreaWidth, Mode=OneWayToSource}" />
			</Charts:Chart.XAxis>

			<Charts:Chart.Series>
				
				<!-- Last value bar -->
				<Charts:CandlestickSeries SelectionMode="Series" ToolTipEnabled="True" ToolTipTemplate="{StaticResource CustomTooltipTemplate}" >
					<Charts:CandlestickSeries.DataSeries>
						<Binding Path="ChartDataVM.LastValueBar.Data" />
					</Charts:CandlestickSeries.DataSeries>					
				</Charts:CandlestickSeries>
				
				<!-- Last value -->
				<Charts:LineSeries SelectionMode="Series" LineStroke="{Binding ChartDataVM.ChartOptionsVM.LastValueVM.Color}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.LastValueVM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.LastValueVM.DrawArea}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.LastValueVM.Thickness}" Visibility="{Binding ChartDataVM.ChartOptionsVM.LastValueVM.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.LastValue.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- BidAsk average -->
				<Charts:LineSeries SelectionMode="Series" LineStroke="{Binding ChartDataVM.ChartOptionsVM.BidAskAverageVM.Color}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.BidAskAverageVM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.BidAskAverageVM.DrawArea}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.BidAskAverageVM.Thickness}" Visibility="{Binding ChartDataVM.ChartOptionsVM.BidAskAverageVM.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.BidAskAverage.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- BidAsk -->
				<Charts:BandSeries SelectionMode="Series" UpperLineStroke="{Binding ChartDataVM.ChartOptionsVM.AskVM.Color}" LowerLineStroke="{Binding ChartDataVM.ChartOptionsVM.BidVM.Color}"  AreaFill="{Binding ChartDataVM.ChartOptionsVM.BidVM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.BidVM.DrawArea}" UpperLineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.AskVM.Thickness}" LowerLineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.BidVM.Thickness}" >
					<Charts:BandSeries.DataSeries>
						<Binding Path="ChartDataVM.BidAsk.Data" />
					</Charts:BandSeries.DataSeries>
				</Charts:BandSeries>
				
				<!-- Average 1 -->
				<Charts:LineSeries SelectionMode="Series" LineStroke="{Binding ChartDataVM.ChartOptionsVM.SMA1VM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.SMA1VM.Thickness}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.SMA1VM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.SMA1VM.DrawArea}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.SMA1.Data" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- Average 2 -->
				<Charts:LineSeries SelectionMode="Series" LineStroke="{Binding ChartDataVM.ChartOptionsVM.SMA2VM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.SMA2VM.Thickness}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.SMA2VM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.SMA2VM.DrawArea}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.SMA2.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- Average 3 -->
				<Charts:LineSeries SelectionMode="Series" LineStroke="{Binding ChartDataVM.ChartOptionsVM.SMA3VM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.SMA3VM.Thickness}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.SMA3VM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.SMA3VM.DrawArea}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.SMA3.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>
			</Charts:Chart.Series>

			<Charts:Chart.Behaviour>
				<Charts:BehaviourManager AllowMultipleEnabled="True" >
					<Charts:ZoomBehaviour BehaviourActivator="Alt" RestrictZoomOutToInitialRange="True" AnimationEnabled="False" />
					<Charts:PanBehaviour BehaviourActivator="Control" AllowPanBeyondData="False" />
					<Charts:CrosshairBehaviour BehaviourActivator="Shift" HideCollidingAxisLabels="True" CrosshairTemplate="{StaticResource CrosshairTemplate}" CrosshairStyle="{StaticResource CrosshairStyle}" />
				</Charts:BehaviourManager>
			</Charts:Chart.Behaviour>
		</Charts:Chart>

		<!-- Indicators -->
		<Charts:Chart Grid.Row="1" LegendPosition="InsideTopRight" PlotAreaBorderStyle="{StaticResource PlotAreaBorderStyle}" LegendStyle="{StaticResource LegendStyle}" Margin="0,10,0,10" Visibility="{Binding IsIndicatorsDataLoaded, Converter={StaticResource BooleanToVisibilityConverter}}" Height="{Binding ActualHeight, ElementName=MainChart, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.18}" ValidationKey="fjiGWGIJwgvrwpigjwgvWRPIJVBwvWJVWGRI==FWOEgiid/FEQgjiewgmñagdskgORGJID+qPny4sfiej39ri+B+RimHg38HpnYuncqfh3JwxT4mdu1mJFgHWHhTpJGLI1+kXI21mhrywMI5bAD7f64kQFRGIrim6ydMz3aPm+eDO2Cd6RbMd0e8s=BQxSUisl3BaWf/7myRmmlIjRnMU2cA7q+/03ZX9wdj30RzapYANf51ee3Pi8m2rVW6aD7t6Hi4Qy5vv9xpaQYXF5T7XzsafhzS3hbBokp36BoJZg8IrceBj742nQajYyV7trx5GIw9jy/V6r0bvctKYwTim7Kzq+YPWGMtqtQoU=PFJTQUtleVZhbHVlPjxNb2R1bHVzPnh6YlRrc2dYWWJvQUh5VGR6dkNzQXUrUVAxQnM5b2VrZUxxZVdacnRFbUx3OHZlWStBK3pteXg4NGpJbFkzT2hGdlNYbHZDSjlKVGZQTTF4S2ZweWZBVXBGeXgxRnVBMThOcDNETUxXR1JJbTJ6WXA3a1YyMEdYZGU3RnJyTHZjdGhIbW1BZ21PTTdwMFBsNWlSKzNVMDg5M1N4b2hCZlJ5RHdEeE9vdDNlMD08L01vZHVsdXM+PEV4cG9uZW50PkFRQUI8L0V4cG9uZW50PjwvUlNBS2V5VmFsdWU+" >
			<Charts:Chart.YAxis>
				<Charts:LinearAxis Foreground="#CCCCCC" ShowMinorTicks="False" MajorTickStyle="{StaticResource MajorTickStyle}" MajorGridlineStyle="{StaticResource MajorGridlineStyle}" ShowGridStripes="True" GridStripeStyle="{StaticResource GridStripeStyle}" Width="{Binding ActualWidth, ElementName=PrimaryAxis}" />
			</Charts:Chart.YAxis>

			<Charts:Chart.SecondaryYAxis>
				<Charts:LinearAxis Foreground="#CCCCCC" ShowMinorTicks="False" ShowMajorGridlines="False" ShowMinorGridlines="False"  MajorTickStyle="{StaticResource MajorTickStyle}" Width="{Binding ActualWidth, ElementName=SecondaryAxis}" />
			</Charts:Chart.SecondaryYAxis>

			<Charts:Chart.XAxis>
				<Charts:DateTimeAxis  Range="{Binding XRange, Mode=TwoWay}" Zoom="{Binding Zoom, Mode=TwoWay}" AutoScaleToVisibleData="False" ShowGridStripes="True" GridStripeStyle="{StaticResource GridStripeStyle}" MajorGridlineStyle="{StaticResource MajorGridlineStyle}" ShowAxis="False" LabelFormatString="HH\\:mm\\:ss" />
			</Charts:Chart.XAxis>

			<Charts:Chart.Series>
				<!-- Stochastic indicator -->
				<Charts:LineSeries SelectionMode="Series" LineStroke="{Binding ChartDataVM.ChartOptionsVM.StochasticVM.Color}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.StochasticVM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.StochasticVM.DrawArea}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.StochasticVM.Thickness}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.Stochastic.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- Gap % -->
				<Charts:LineSeries SelectionMode="Series" ShowArea="{Binding ChartDataVM.ChartOptionsVM.GapVM.DrawArea}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.GapVM.AreaColor}" LineStroke="{Binding ChartDataVM.ChartOptionsVM.GapVM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.GapVM.Thickness}" YAxis="{Binding SecondaryYAxis, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Charts:Chart}}}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.Gap.Data" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- Trix -->
				<Charts:LineSeries ShowPoints="True" SelectionMode="Series" ShowArea="{Binding ChartDataVM.ChartOptionsVM.TrixVM.DrawArea}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.TrixVM.AreaColor}" LineStroke="{Binding ChartDataVM.ChartOptionsVM.TrixVM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.TrixVM.Thickness}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.Trix.Data" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- Trix Change Ratio -->
				<Charts:LineSeries SelectionMode="Series" ShowArea="{Binding ChartDataVM.ChartOptionsVM.TrixChangeRatioVM.DrawArea}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.TrixChangeRatioVM.AreaColor}" LineStroke="{Binding ChartDataVM.ChartOptionsVM.TrixChangeRatioVM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.TrixChangeRatioVM.Thickness}" YAxis="{Binding SecondaryYAxis, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Charts:Chart}}}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.TrixRatioOfChange.Data" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>
			</Charts:Chart.Series>

			<Charts:Chart.Behaviour>
				<Charts:BehaviourManager AllowMultipleEnabled="True" >
					<Charts:ZoomBehaviour YZoomEnabled="False" BehaviourActivator="Alt" RestrictZoomOutToInitialRange="True" AnimationEnabled="False" />
					<Charts:PanBehaviour BehaviourActivator="Control" AllowPanBeyondData="False" YPanEnabled="False" />
					<Charts:CrosshairBehaviour BehaviourActivator="Shift" HideCollidingAxisLabels="True" CrosshairTemplate="{StaticResource CrosshairTemplate}" CrosshairStyle="{StaticResource CrosshairStyle}" />
				</Charts:BehaviourManager>
			</Charts:Chart.Behaviour>
		</Charts:Chart>

		<!-- Volume Indicators Chart -->
		<Charts:Chart Grid.Row="2" LegendPosition="InsideTopRight" PlotAreaBorderStyle="{StaticResource PlotAreaBorderStyle}" LegendStyle="{StaticResource LegendStyle}" x:Name="VolumeChart" Margin="0,10,0,0" Visibility="{Binding IsVolumeDataLoaded, Converter={StaticResource BooleanToVisibilityConverter}}" Height="{Binding ActualHeight, ElementName=MainChart, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.18}" ValidationKey="fjiGWGIJwgvrwpigjwgvWRPIJVBwvWJVWGRI==FWOEgiid/FEQgjiewgmñagdskgORGJID+qPny4sfiej39ri+B+RimHg38HpnYuncqfh3JwxT4mdu1mJFgHWHhTpJGLI1+kXI21mhrywMI5bAD7f64kQFRGIrim6ydMz3aPm+eDO2Cd6RbMd0e8s=BQxSUisl3BaWf/7myRmmlIjRnMU2cA7q+/03ZX9wdj30RzapYANf51ee3Pi8m2rVW6aD7t6Hi4Qy5vv9xpaQYXF5T7XzsafhzS3hbBokp36BoJZg8IrceBj742nQajYyV7trx5GIw9jy/V6r0bvctKYwTim7Kzq+YPWGMtqtQoU=PFJTQUtleVZhbHVlPjxNb2R1bHVzPnh6YlRrc2dYWWJvQUh5VGR6dkNzQXUrUVAxQnM5b2VrZUxxZVdacnRFbUx3OHZlWStBK3pteXg4NGpJbFkzT2hGdlNYbHZDSjlKVGZQTTF4S2ZweWZBVXBGeXgxRnVBMThOcDNETUxXR1JJbTJ6WXA3a1YyMEdYZGU3RnJyTHZjdGhIbW1BZ21PTTdwMFBsNWlSKzNVMDg5M1N4b2hCZlJ5RHdEeE9vdDNlMD08L01vZHVsdXM+PEV4cG9uZW50PkFRQUI8L0V4cG9uZW50PjwvUlNBS2V5VmFsdWU+" >

			<Charts:Chart.YAxis>
				<Charts:LinearAxis Foreground="#CCCCCC" ShowMinorTicks="False" MajorTickStyle="{StaticResource MajorTickStyle}" MajorGridlineStyle="{StaticResource MajorGridlineStyle}" ShowGridStripes="True" GridStripeStyle="{StaticResource GridStripeStyle}" x:Name="PrimaryAxis" />
			</Charts:Chart.YAxis>

			<Charts:Chart.SecondaryYAxis>
				<Charts:LinearAxis ShowMajorGridlines="False" ShowMinorGridlines="False" ShowMinorTicks="False" Foreground="#CCCCCC" MajorTickStyle="{StaticResource MajorTickStyle}" MajorGridlineStyle="{StaticResource MajorGridlineStyle}" x:Name="SecondaryAxis" ShowAxis="{Binding ChartDataVM.ChartOptionsVM.TotalVolumeVM.IsEnabled}" />
			</Charts:Chart.SecondaryYAxis>

			<Charts:Chart.XAxis>
				<Charts:DateTimeAxis Range="{Binding XRange, Mode=TwoWay}" Zoom="{Binding Zoom, Mode=TwoWay}" AutoScaleToVisibleData="False" Foreground="#CCCCCC" LabelFormatString="HH\\:mm\\:ss" ShowMinorTicks="False" MajorTickStyle="{StaticResource MajorTickStyle}" MajorGridlineStyle="{StaticResource MajorGridlineStyle}" ShowGridStripes="True" GridStripeStyle="{StaticResource GridStripeStyle}"  />
			</Charts:Chart.XAxis>

			<Charts:Chart.Series>
				<!-- Accummulated Volume -->
				<Charts:ColumnSeries SelectionMode="Series" Visibility="{Binding ChartDataVM.ChartOptionsVM.VolumeVM.IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}" PointFill="{Binding ChartDataVM.ChartOptionsVM.VolumeVM.Color}" >
					<Charts:ColumnSeries.PointStroke>
						<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
							<GradientStopCollection>
								<GradientStop Color="#EDEDED" Offset="0.0" />
								<GradientStop Color="#02BAEC" Offset="1.0" />
							</GradientStopCollection>
						</LinearGradientBrush>
					</Charts:ColumnSeries.PointStroke>

					<Charts:ColumnSeries.DataSeries>
						<Binding Path="ChartDataVM.Volume.Data" />
					</Charts:ColumnSeries.DataSeries>
				</Charts:ColumnSeries>

				<!-- Total Volume -->
				<Charts:LineSeries SelectionMode="Series" ShowArea="{Binding ChartDataVM.ChartOptionsVM.TotalVolumeVM.DrawArea}" YAxis="{Binding SecondaryYAxis, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Charts:Chart}}}" LineStroke="{Binding ChartDataVM.ChartOptionsVM.TotalVolumeVM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.TotalVolumeVM.Thickness}" AreaFill="{Binding ChartDataVM.ChartOptionsVM.TotalVolumeVM.AreaColor}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.TotalVolume.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>

				<!-- Average Volume -->
				<Charts:LineSeries SelectionMode="Series" AreaFill="{Binding ChartDataVM.ChartOptionsVM.AverageVolumeVM.AreaColor}" ShowArea="{Binding ChartDataVM.ChartOptionsVM.AverageVolumeVM.DrawArea}" LineStroke="{Binding ChartDataVM.ChartOptionsVM.AverageVolumeVM.Color}" LineStrokeThickness="{Binding ChartDataVM.ChartOptionsVM.AverageVolumeVM.Thickness}" >
					<Charts:LineSeries.DataSeries>
						<Binding Path="ChartDataVM.AverageVolume.FilteredData" />
					</Charts:LineSeries.DataSeries>
				</Charts:LineSeries>
			</Charts:Chart.Series>

			<Charts:Chart.Behaviour>
				<Charts:BehaviourManager AllowMultipleEnabled="True" >
					<Charts:ZoomBehaviour BehaviourActivator="Alt" RestrictZoomOutToInitialRange="True" AnimationEnabled="False" DisableAxisRendering="True" DisableDataLabelRendering="True" />
					<Charts:PanBehaviour BehaviourActivator="Control" AllowPanBeyondData="False" YPanEnabled="False" />
					<Charts:CrosshairBehaviour BehaviourActivator="Shift" HideCollidingAxisLabels="True" CrosshairTemplate="{StaticResource CrosshairTemplate}" CrosshairStyle="{StaticResource CrosshairStyle}" />
				</Charts:BehaviourManager>
			</Charts:Chart.Behaviour>
		</Charts:Chart>
	</Grid>
</UserControl>
